package resources;

import main.Lists;
import processes.ProcPrimitives;
import processes.Process;

/**
 *
 * @author Ramunas
 */
public class Resource extends ResDescriptor{
    private Integer id; //vidinis vardas
    private String required;
    private String user;

    
    public void distributeResource(){
        Integer element = waitingProcesses.removeFirst();
        Process process = Lists.getProcessById(element);
        process.getResources().add(this);
        user = process.getName();
        process.setState("Pasiruoses");
        ProcPrimitives.addReady(process);
        //ProcPrimitives.processPlanner();
    }
    
    /**
     * @return the id
     */
    public Integer getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * @return the required
     */
    public String getRequired() {
        return required;
    }

    /**
     * @param required the required to set
     */
    public void setRequired(String required) {
        this.required = required;
    }

    /**
     * @return the user
     */
    public String getUser() {
        return user;
    }

    /**
     * @param user the user to set
     */
    public void setUser(String user) {
        this.user = user;
    }
    
}
